import {LocalStore} from "@/driver/LocalStore"
import StringUtils from "@/utils/StringUtils"

const DeviceService = {
    __KEY_DEVICE_CODE: "device.unicode",
    /**
     * 获取设备唯一识别码.
     * @param call
     */
    getDeviceCode(call) {
        LocalStore.get(this.__KEY_DEVICE_CODE, (data) => {
            if (!data) {
                data = StringUtils.guid()
                LocalStore.save(this.__KEY_DEVICE_CODE, data)
            }

            call(data)
        })
    }
}

export default DeviceService